package com.prim.jmm;

public class DomeVisbility {
    int i = 0;
    volatile boolean interrupt = true;

    public static void main(String[] args) throws InterruptedException {
        DomeVisbility domeVisbility = new DomeVisbility();
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("I am ...." + domeVisbility.interrupt);
                while (domeVisbility.interrupt) {
                    domeVisbility.i++;
                }
                System.out.println(domeVisbility.i);
            }
        }).start();
        Thread.sleep(3000L);
        domeVisbility.interrupt = false;
        System.out.println("shutdown...");
    }
}
